package o;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import androidx.annotation.NonNull;
import com.huawei.appgallery.foundation.card.base.bean.BaseDistCardBean;
import java.util.LinkedHashMap;
import o.ewm.i;
import o.ewm.n;

public class ewd implements ewa, OnDismissListener {
    private Context ˊ;
    c ˋ;
    private cku ˏ;
    private BaseDistCardBean ॱ;

    public interface c {
        void ˋ(Context context);

        void ˎ();
    }

    public enum e {
        OPEN_APP,
        DOWNLOAD_APP
    }

    public ewd(@NonNull Context context, @NonNull BaseDistCardBean baseDistCardBean, e eVar, c cVar) {
        CharSequence quantityString;
        this.ˊ = context;
        this.ॱ = baseDistCardBean;
        this.ˋ = cVar;
        int ʻॱ = baseDistCardBean.ʻॱ();
        String v_ = baseDistCardBean.v_();
        CharSequence string = context.getString(n.ˋՙ);
        if (eVar == e.DOWNLOAD_APP) {
            quantityString = context.getResources().getQuantityString(i.ˏ, ʻॱ, new Object[]{v_, Integer.valueOf(ʻॱ), string});
        } else {
            quantityString = context.getResources().getQuantityString(i.ˋ, ʻॱ, new Object[]{v_, Integer.valueOf(ʻॱ), string});
        }
        this.ˏ = cku.ˋ(null, quantityString);
        this.ˏ.ॱ(-1, string);
        this.ˏ.ˋ((ewa) this);
        this.ˏ.ˎ((OnDismissListener) this);
    }

    public void ˋ() {
        ˋ("130902", this.ॱ.ॱـ(), this.ॱ.ʻॱ());
        this.ˏ.ˎ(this.ˊ);
    }

    private void ˎ(Context context) {
        ˋ("130903", this.ॱ.ॱـ(), this.ॱ.ʻॱ());
        if (this.ˋ != null) {
            this.ˋ.ˋ(context);
        }
    }

    private void ˎ() {
        ˋ("130904", this.ॱ.ॱـ(), this.ॱ.ʻॱ());
        if (this.ˋ != null) {
            this.ˋ.ˎ();
        }
    }

    public void ˏ(Activity activity, DialogInterface dialogInterface, int i) {
        if (i == -1) {
            ˎ(activity);
        } else if (i == -2) {
            ˎ();
        }
    }

    public void ˊ(Activity activity, DialogInterface dialogInterface) {
        ˋ("130904", this.ॱ.ॱـ(), this.ॱ.ʻॱ());
    }

    public void onDismiss(DialogInterface dialogInterface) {
        if (this.ˋ != null) {
            this.ˋ.ˎ();
        }
    }

    private void ˋ(String str, String str2, int i) {
        LinkedHashMap linkedHashMap = new LinkedHashMap(4);
        linkedHashMap.put("PackageName", str2);
        linkedHashMap.put("age", String.valueOf(i));
        dgh.ˋ(str, linkedHashMap);
    }
}
